package ru.xpparty.scanner;

/**
 * Created by IntelliJ IDEA.
 * User: vanger
 * Date: 19.12.10
 * Time: 14:59
 * To change this template use File | Settings | File Templates.
 */
public class Host {
    private final String ip;
    private final int port;

    public Host(String ip, int port) {
        this.ip = ip;
        this.port = port;
    }

    public String getIp() {
        return ip;
    }

    public int getPort() {
        return port;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Host host = (Host) o;

        if (port != host.port) return false;
        if (ip != null ? !ip.equals(host.ip) : host.ip != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = ip != null ? ip.hashCode() : 0;
        result = 31 * result + port;
        return result;
    }

    @Override
    public String toString() {
        return "Host " +
                ip + ':' + port;
    }
}
